package org.hiucung.lib_voice.words

import android.content.Context
import org.hiucung.lib_voice.R
import kotlin.random.Random

/**
 * @title: WordsToos
 * @projectName OrangeAiVoiceApp
 * @description: TODO
 * @author Kicc
 * @date 2021/11/25 15:29
 */
object WordsTools {

    //唤醒词条
    private lateinit var wakeupArray: Array<String>
    //无法应答
    private lateinit var noAnswerArray: Array<String>
    //暂不支持功能
    private lateinit var noSupportArray: Array<String>

    //初始化工具预设台词
    fun initTools(mContext: Context){
        mContext.apply {
            wakeupArray= resources.getStringArray(R.array.WakeUpListArray)
            noAnswerArray= resources.getStringArray(R.array.NoAnswerArray)
            noSupportArray = resources.getStringArray(R.array.NoSupportArray)
        }
    }

    fun wakeupWords():String{
        return randomArray(wakeupArray)
    }

    fun noAnswerArray():String{
        return randomArray(noAnswerArray)
    }

    fun noSupportArray():String{
        return randomArray(noSupportArray)
    }

    private fun randomArray(array: Array<String>): String{
        return array[Random.nextInt(array.size)]
    }
}